home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 2 / AACD 2.iso / AACD / Programming / fpc / rexx / make.rexx < prev   
Encoding:
OS/2 REXX Batch file  |  1998-09-23  |  2.6 KB  |  149 lines

  1. /*
  2.  
  3.   A simple make script for FPC Pascal.
  4.  
  5.   For your final release you can use this script
  6.   to get the smallest possible program.
  7.  
  8.   If you are using the ms-dos cross compiler you
  9.   can use this script to assemble and link your
  10.   programs.
  11.   This is what I started with, compiled all units
  12.   on ms-dos and moved them over to my Amiga. There
  13.   I assembled all to objectfiles. Now I could
  14.   compile testprograms on ms-dos, move to Amiga
  15.   and use this script to put it all together.
  16.  
  17.   Usage:
  18.  
  19.   rx make testprog.pas exec intuition graphics
  20.  
  21.   This will compile testprog.pas and link
  22.   prt0.o, sysamiga.o, exec.o, intuition.o,
  23.   graphics.o and testprog.o to testprog.
  24.  
  25.   rx make testprog.asm exec intuition graphics
  26.  
  27.   The same as above but it just assembles
  28.   testprog.asm and links it.
  29.  
  30.   rx make testprog exec intuition graphics
  31.  
  32.   The same as above, treats testprog as an
  33.   assembler file.
  34.  
  35.  
  36.   Don't forget so set the correct paths for
  37.   the binaries bellow.
  38.  
  39.   This is just a quick hack but it does work.
  40.  
  41.   nils.sjoholm@mailbox.swipnet.se
  42.  
  43. */
  44.  
  45. SIGNAL ON BREAK_C
  46. SIGNAL ON SYNTAX
  47.  
  48.  
  49. parse arg main list
  50.  
  51. /*
  52.   First parse the args and set up a list
  53. */
  54.  
  55. k = 0           œ
  56. do while list ~= ''
  57. parse var list keyword.k list
  58. k=k+1
  59. end
  60.  
  61. /*
  62.   Set the correct path
  63. */
  64.  
  65. ASCOM    = 'dh1:fpc/bin/as'
  66. LDCOM    = 'dh1:fpc/bin/ld'
  67. UNITS    = 'dh1:fpc/units/'
  68. SYSUNITS = 'dh1:fpc/lib/'
  69. PPCCOM   = 'dh1:fpc/bin/ppc'
  70. STRIPCOM = 'dh1:fpc/bin/strip'
  71.  
  72. /*
  73.   Set the system units in the list
  74. */
  75.  
  76. linkline = SYSUNITS || 'prt0.o ' || SYSUNITS || 'sysamiga.o '
  77.  
  78. /*
  79.   If there are more args, put in linklist
  80. */
  81.  
  82. do n=0 to k-1
  83. linkline = linkline || UNITS || keyword.n || '.o'||' '
  84. end
  85.  
  86. /*
  87.   Check if it's  a pascal or assembler file
  88. */
  89.  
  90. parse var main head '.' ext
  91. if upper(ext) = 'PAS' | upper(ext) = 'P' | upper(ext) = 'PP'  then do
  92.    say 'Compiling ' || main
  93.    address command PPCCOM || ' ' main || ' -Cn'
  94.    if rc ~=0 then do
  95.      say 'Problems with compiler'
  96.      exit
  97.    end
  98. end
  99. else do
  100.    parse var main head '.' ext
  101.    say 'Assembling ' || head
  102.    address command ASCOM || ' ' || head || '.asm' || ' -o ' || head || '.o'
  103.    if rc ~=0 then do
  104.      say 'Problems with assembler'
  105.    exit
  106.    end
  107. end
  108.  
  109. /*
  110.   If we got here add to linklist
  111. */
  112.  
  113. linkline = linkline || head || '.o' || ' -o ' || head
  114.  
  115. /*
  116.   Now link the files
  117. */
  118.  
  119. say 'Linking ' || head
  120. address command LDCOM || ' ' || linkline
  121. if rc ~=0 then do
  122.   say 'Problems with linker'
  123.   exit
  124.   end
  125.  
  126. /*
  127.   Use strip
  128. */
  129.  
  130. say 'Using Strip on ' || head
  131. address command STRIPCOM || ' ' || head
  132. if rc ~=0 then do
  133.   say 'Problems with strip'
  134.   exit
  135.   end
  136.  
  137. say 'Done with ' || head
  138. exit
  139.  
  140. BREAK_C:
  141. SYNTAX:
  142. SAY "Sorry, error line" SIGL ":" ErrorText(RC) ":-("
  143. EXIT
  144.  
  145.  
  146.  
  147.  
  148.  
  149.